class Address {
	String prov
	String city
}

class Person {
	String id
	String name
	Address addr
}

def addr = new Address(prov: 'Hubei', city: 'Xiaogan')
def person = new Person(id: 123, name: 'Wallace', addr: addr)
println person.name
println person.addr.city


def text = """
	<persons>
		<person sex='male'>
			<id>1</id>
			<name>Tom</name>
	    </person>

	    <person sex='female'>
			<id>2</id>
			<name>Alice</name>
		</person>
	</persons>
"""

def doc = new XmlSlurper().parseText(text)
doc.person.each {
	println it.name
	println it.@sex
}